<template>
	<view class="page-wrap" :data-theme="theme" :class="theme" :style="globalColor.style">
		<HeadCustom title="收到的面试" :isAppBtn="false"></HeadCustom>
		<view class="card-box">
			<view class="card-bd fboxCol Ycenter Xcenter">
				<view v-if="listConfig.loading == 'list-not'">
					<NotEmpty />
				</view>
				<view class="card-scroll ptb40" v-if="listData.length || listConfig.loading =='loading'">
					<view v-for="(item, index) in listData" :key="index">
						<RecruitmentItem type="myInterview" :innerData="item" />
					</view>
					<u-loadmore fontSize="24rpx" :status="listConfig.loading" />
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {myInterview, resumeInfo} from '@/api/recruit.js';
	import RecruitmentItem from '@/components/card/recruitment-item.vue';
	import {listMixins} from '../common/list.mixins.js';
	import { getRequest } from '@/static/js/common.js';
	import { utf8to16, base64decode} from '@/static/js/Base64.js';
	export default {
		mixins: [listMixins],
		components:{RecruitmentItem},
		data() {
			return {
				theme: getApp().globalData.appTheme,
						globalColor: getApp().globalData.globalColor,
				scrollTop: 0,
				listConfig: {
					current: 1,
					size: 20,
					count: 0,
					loading: 'loading'
				},
				listData: []
			}
		},
		onLoad(option) {
			if(option && option.benwu){
				const benwu = utf8to16(base64decode(option.benwu))
				const token = {
					access_token: getRequest(benwu,'token'),
					userId: getRequest(benwu,'userId'),
					pageType: getRequest(benwu,'pageType'),
					statusBarHeight: getRequest(benwu,'statusBarHeight')
				}
				this.pageType = token.pageType
				// this.id =  getRequest(benwu,'id')
				console.log(benwu)
				getApp().globalData.userId = token.userId
				getApp().globalData.statusBarHeight = token.statusBarHeight
				uni.setStorageSync('bw_params', JSON.stringify(token));
				// this.getInit()
			}
			this.getResumeInfo()
		},
		onShow() {
			this.getInit()
		},
		methods: {
			getResumeInfo(){
				resumeInfo().then(res=>{
					if(res.data){
						getApp().globalData.vitaTemp = res.data
					}
				})
			},
			getInit(){
				this.listConfig = {
					current: 1,
					size: 20,
					count: 0,
					loading: 'loading'
				}
				this.listData = []
				this.getList()
			},
			getList(){
				const { current, size, loading} = this.listConfig
				myInterview({current, size}).then(res=>{
					if(this.listData.length){
						this.listData = this.listData.concat(res.data.list) 
					}else{
						this.listData = res.data.list
					}
					this.listLoading(res)
				})
			},
			onReachBottom(){
				this.listMore()
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	.page-wrap{min-height: calc(100vh);}
	// .card-scroll{width: 702rpx;}
	.card-scroll{width: 100%;padding: 40rpx 20rpx;}
</style>
